package javase.reflection;

public class InitialitionTest {
	
	@SuppressWarnings({ "unused", "unchecked" })
	public static void main(String[] args) {
		// does not initialize instance
		Class<SimpleClass> SimpleClassType = SimpleClass.class;
		System.out.println("Obtained Class<SimpleClass> using SimpleClass.class\n");
		
		
		// performs static initialization
		try {
			SimpleClassType = (Class<SimpleClass>) Class.forName("javase.reflection.SimpleClass");
		} catch (ClassNotFoundException e) {
			System.out.println("Class javase.reflection.SimpleClass not found.");
			e.printStackTrace();
		}
		System.out.println("Obtained Class<SimpleClass> using Class.forName()\n");
		
		// requires existing instance
		Object simpleClassInstance = new SimpleClass();
		SimpleClassType = (Class<SimpleClass>) simpleClassInstance.getClass();
		System.out.println("Obtained Class<SimpleClass> from existing instane\n");
	}
}
